bitkeeper revision 1.51 (3e4f67279oV-bmkkWw6EtRDc-swzow)
authorkaf24@labyrinth.cl.cam.ac.uk <kaf24@labyrinth.cl.cam.ac.uk>
Sun, 16 Feb 2003 10:25:43 +0000 (10:25 +0000)
committerkaf24@labyrinth.cl.cam.ac.uk <kaf24@labyrinth.cl.cam.ac.uk>
Sun, 16 Feb 2003 10:25:43 +0000 (10:25 +0000)
time.c, dom0_core.c, defconfig, dev.c, domain.c:
  Minor cleanups.

xen-2.4.16/arch/i386/time.c
xen-2.4.16/common/domain.c
xen-2.4.16/net/dev.c
xenolinux-2.4.16-sparse/arch/xeno/defconfig
xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/dom0_core.c
xenolinux-2.4.16-sparse/arch/xeno/kernel/time.c

index ef9417e88a05907a9521589402cfad3ca8367b92..28803d2273f4b5348aa7c1764a21fde9c898df43 100644 (file)
@@ -182,8 +182,8 @@ mktime (unsigned int year, unsigned int mon,
        }
        return ((((unsigned long)(year/4 - year/100 + year/400 + 367*mon/12 + day)+
                          year*365 - 719499
-                                )*24 + hour /* now have hours */
-                               )*60 + min /* now have minutes */
+        )*24 + hour /* now have hours */
+        )*60 + min /* now have minutes */
         )*60 + sec; /* finally seconds */
 }
 
@@ -214,14 +214,14 @@ static unsigned long get_cmos_time(void)
                year = CMOS_READ(RTC_YEAR);
        } while (sec != CMOS_READ(RTC_SECONDS));
        if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
-         {
+    {
            BCD_TO_BIN(sec);
            BCD_TO_BIN(min);
            BCD_TO_BIN(hour);
            BCD_TO_BIN(day);
            BCD_TO_BIN(mon);
            BCD_TO_BIN(year);
-         }
+    }
        spin_unlock(&rtc_lock);
        if ((year += 1900) < 1970)
                year += 100;
@@ -337,16 +337,15 @@ static void update_time(unsigned long foo)
        new_st = NOW();
        rdtscl(new_pcc);
 
-       /* update system time  */
+       /* Update system time. */
        spin_lock_irqsave(&stime_lock, flags);
-
        stime_now = new_st;
        stime_pcc=new_pcc;
+    /* Don't reeenable IRQs until we release wctime_lock. */
+       spin_unlock(&stime_lock);
 
-       spin_unlock_irqrestore(&stime_lock, flags);
-
-       /* update wall clock time  */
-       spin_lock_irqsave(&wctime_lock, flags);
+       /* Update wall clock time. */
+       spin_lock(&wctime_lock);
        usec = ((unsigned long)(new_st - wctime_st))/1000;
        usec += wall_clock_time.tv_usec;
        while (usec >= 1000000) {
@@ -360,7 +359,8 @@ static void update_time(unsigned long foo)
        TRC(printk("TIME[%02d] update time: stime_now=%lld now=%lld,wct=%ld:%ld\n",
                           smp_processor_id(), stime_now, new_st, wall_clock_time.tv_sec,
                           wall_clock_time.tv_usec));
-       /* reload timer */
+
+       /* Reload the timer. */
  again:
        update_timer.expires  = new_st + MILLISECS(200);
        if(add_ac_timer(&update_timer) == 1) {
index 1488ff612cef88af3af9b16ab168b2f222ab4eb8..311f7cc2198c9495de542586408b74ec5dcf5956 100644 (file)
@@ -137,39 +137,6 @@ long kill_other_domain(unsigned int dom)
 }
 
 
-/* Release resources belonging to task @p. */
-void release_task(struct task_struct *p)
-{
-    struct list_head *list_ent, *tmp;
-    ASSERT(p->state == TASK_DYING);
-    ASSERT(!p->has_cpu);
-    write_lock_irq(&tasklist_lock);
-    REMOVE_LINKS(p);
-    write_unlock_irq(&tasklist_lock);
-
-    /*
-     * Safe! Only queue skbuffs with tasklist_lock held.
-     * Only access shared_info with tasklist_lock held.
-     * And free_task_struct() only releases if refcnt == 0.
-     */
-    while ( p->num_net_vifs )
-    {
-        destroy_net_vif(p);
-    }
-    if ( p->mm.perdomain_pt ) free_page((unsigned long)p->mm.perdomain_pt);
-    free_page((unsigned long)p->shared_info);
-
-    list_for_each_safe(list_ent, tmp, &p->pg_head)
-    {
-        struct pfn_info *pf = list_entry(list_ent, struct pfn_info, list);
-        pf->type_count = pf->tot_count = pf->flags = 0;
-        list_del(list_ent);
-        list_add(list_ent, &free_list);
-    }
-
-    free_task_struct(p);
-}
-
 unsigned int alloc_new_dom_mem(struct task_struct *p, unsigned int kbytes)
 {
     struct list_head *temp;
@@ -206,6 +173,83 @@ unsigned int alloc_new_dom_mem(struct task_struct *p, unsigned int kbytes)
     return 0;
 }
  
+
+void free_all_dom_mem(struct task_struct *p)
+{
+    struct list_head *list_ent, *tmp;
+
+    list_for_each_safe(list_ent, tmp, &p->pg_head)
+    {
+        struct pfn_info *pf = list_entry(list_ent, struct pfn_info, list);
+        pf->type_count = pf->tot_count = pf->flags = 0;
+        list_del(list_ent);
+        list_add(list_ent, &free_list);
+    }
+
+    p->tot_pages = 0;
+}
+
+
+/* Release resources belonging to task @p. */
+void release_task(struct task_struct *p)
+{
+    ASSERT(p->state == TASK_DYING);
+    ASSERT(!p->has_cpu);
+    write_lock_irq(&tasklist_lock);
+    REMOVE_LINKS(p);
+    write_unlock_irq(&tasklist_lock);
+
+    /*
+     * Safe! Only queue skbuffs with tasklist_lock held.
+     * Only access shared_info with tasklist_lock held.
+     * And free_task_struct() only releases if refcnt == 0.
+     */
+    while ( p->num_net_vifs )
+    {
+        destroy_net_vif(p);
+    }
+    if ( p->mm.perdomain_pt ) free_page((unsigned long)p->mm.perdomain_pt);
+    free_page((unsigned long)p->shared_info);
+
+    free_all_dom_mem(p);
+
+    free_task_struct(p);
+}
+
+
+void construct_cmdline(char *dst, struct task_struct *p)
+{
+    int dom = p->domain;
+    unsigned char boot[150];
+    unsigned char ipbase[20], nfsserv[20], gateway[20], netmask[20];
+    unsigned char nfsroot[70];
+
+    if ( strcmp("",opt_nfsroot) )
+    {
+        /* NFS root for Xenolinux. */
+        snprintf(nfsroot, 70, opt_nfsroot, dom); 
+        snprintf(boot, 200,
+                " root=/dev/nfs ip=%s:%s:%s:%s::eth0:off nfsroot=%s",
+                 quad_to_str(opt_ipbase + dom, ipbase),
+                 quad_to_str(opt_nfsserv, nfsserv),
+                 quad_to_str(opt_gateway, gateway),
+                 quad_to_str(opt_netmask, netmask),
+                 nfsroot);
+    }
+    else
+    {   
+        /* Non-NFS root for Xenolinux. */
+        snprintf(boot, 200,
+                " ip=%s::%s:%s::eth0:off",
+                 quad_to_str(opt_ipbase + dom, ipbase),
+                 quad_to_str(opt_gateway, gateway),
+                 quad_to_str(opt_netmask, netmask));
+    }
+
+    strcpy(dst, boot);
+}
+
+
 /* final_setup_guestos is used for final setup and launching of domains other
  * than domain 0. ie. the domains that are being built by the userspace dom0
  * domain builder.
@@ -311,21 +355,7 @@ int final_setup_guestos(struct task_struct * p, dom_meminfo_t * meminfo)
     }
     *dst = '\0';
 
-    if ( opt_nfsroot )
-    {
-        unsigned char boot[150];
-        unsigned char ipbase[20], nfsserv[20], gateway[20], netmask[20];
-        unsigned char nfsroot[70];
-        snprintf(nfsroot, 70, opt_nfsroot, p->domain); 
-        snprintf(boot, 200,
-                " root=/dev/nfs ip=%s:%s:%s:%s::eth0:off nfsroot=%s",
-                 quad_to_str(opt_ipbase + p->domain, ipbase),
-                 quad_to_str(opt_nfsserv, nfsserv),
-                 quad_to_str(opt_gateway, gateway),
-                 quad_to_str(opt_netmask, netmask),
-                 nfsroot);
-        strcpy(dst, boot);
-    }
+    construct_cmdline(dst, p);
 
     /* Reinstate the caller's page tables. */
     __asm__ __volatile__ (
@@ -404,7 +434,7 @@ int setup_guestos(struct task_struct *p, dom0_newdomain_t *params)
                dom, (mod[nr_mods-1].mod_end-mod[0].mod_start)>>20,
                (params->memory_kb)>>11,
                (params->memory_kb)>>10);
-        /* XXX should free domain memory here XXX */
+        free_all_dom_mem(p);
         return -1;
     }
 
@@ -578,34 +608,8 @@ int setup_guestos(struct task_struct *p, dom0_newdomain_t *params)
         }
     }
     *dst = '\0';
-//printk("opt_nfsroot=%d,%s XX cmd =: %s\n",opt_nfsroot,opt_nfsroot,virt_startinfo_address->cmd_line);
 
-    if ( strcmp("",opt_nfsroot) )
-    {   // if nfsroot has been set to something
-        unsigned char boot[150];
-        unsigned char ipbase[20], nfsserv[20], gateway[20], netmask[20];
-        unsigned char nfsroot[70];
-        snprintf(nfsroot, 70, opt_nfsroot, dom); 
-        snprintf(boot, 200,
-                " root=/dev/nfs ip=%s:%s:%s:%s::eth0:off nfsroot=%s",
-                 quad_to_str(opt_ipbase + dom, ipbase),
-                 quad_to_str(opt_nfsserv, nfsserv),
-                 quad_to_str(opt_gateway, gateway),
-                 quad_to_str(opt_netmask, netmask),
-                 nfsroot);
-        strcpy(dst, boot);
-    }
-    else
-    {   
-        unsigned char boot[150];
-        unsigned char ipbase[20], nfsserv[20], gateway[20], netmask[20];
-        snprintf(boot, 200,
-                " ip=%s::%s:%s::eth0:off",
-                 quad_to_str(opt_ipbase + dom, ipbase),
-                 quad_to_str(opt_gateway, gateway),
-                 quad_to_str(opt_netmask, netmask));
-        strcpy(dst, boot);
-    }
+    construct_cmdline(dst, p);
 
 
     /* Reinstate the caller's page tables. */
index 1ce6e9649eae68169006cccb18e8e67900501f51..1d024cb805e71c2f5ed64e58b64467c28b3d7ef3 100644 (file)
@@ -40,7 +40,7 @@
 #define rtnl_unlock() ((void)0)
 #define dst_init() ((void)0)
 
-#if 1
+#if 0
 #define DPRINTK(_f, _a...) printk(_f , ## _a)
 #else 
 #define DPRINTK(_f, _a...) ((void)0)
index ee0a632e4d8b1405ff9121e5ca6dfa52ec62582e..ae0967ce64d9bdd02d5fa77374ce68c7f396e8e9 100644 (file)
@@ -113,7 +113,7 @@ CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_NBD=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
-CONFIG_BLK_DEV_INITRD=y
+# CONFIG_BLK_DEV_INITRD is not set
 CONFIG_XENOLINUX_BLOCK=y
 
 #
index 0cc35d983260e6f02a0aaa49f4fc4d8fb9c72438..86ac7ebab54fbc06d64df3a2b885cfd22ed6694c 100644 (file)
@@ -212,11 +212,8 @@ static int cmd_write_proc(struct file *file, const char *buffer,
     }
     else if ( op.cmd == DO_PGUPDATES )
     {
-        p = op.u.pgupdate.pgt_update_arr;
-        for ( i = 0; i < op.u.pgupdate.num_pgt_updates; i++ )
-        {
-            ret = HYPERVISOR_pt_update(p + i*8, 1);
-        }
+        ret = HYPERVISOR_pt_update(op.u.pgupdate.pgt_update_arr,
+                                   op.u.pgupdate.num_pgt_updates);
     }
     else
     {
index 4999af6642adcaf571cf7018d0ea4f9c42ffe7cb..eb5757cdc2c8f6405c6a3741c526688f3256dd0b 100644 (file)
@@ -241,11 +241,11 @@ static inline void do_timer_interrupt(int irq, void *dev_id,
 {
        struct timeval tv;
        long long time, delta;
-
+       
 #ifdef XENO_TIME_DEBUG
        static u32 foo_count = 0;
        foo_count++;            
-       if (foo_count>= 10000) {
+       if (foo_count>= 1000) {
                s64 n = NOW();
                struct timeval tv;
                do_gettimeofday(&tv);
@@ -254,7 +254,6 @@ static inline void do_timer_interrupt(int irq, void *dev_id,
                foo_count = 0;
        }
 #endif
-
     /*
      * The next bit really sucks:
      * Linux not only uses do_gettimeofday() to keep a notion of